import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;


public class ScreenCaptureTools
{
	public static BufferedImage ScreenCapture() throws AWTException
	{
		return ScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
	}
	

	public static BufferedImage ScreenCapture(Dimension d) throws AWTException
	{
		return ScreenCapture(new Rectangle(d));
	}
	
	
	public static BufferedImage ScreenCapture(int x ,int y , int width , int height) throws AWTException
	{
		return ScreenCapture(new Rectangle(x, y, width, height));
	}
	
	
	private static BufferedImage ScreenCapture(Rectangle r) throws AWTException
	{
		Robot robot = new Robot();
		BufferedImage data = robot.createScreenCapture(r);
		return data;
	}
	
	
	
}
